<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;
use DB;

class GoodsDetailController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function getIndex(Request $request)
    {  
        $goodspic = $request -> input('goods');
        $goodsdata = DB::table('tbl_goods')->where('goodspic',$goodspic)->first();
        $gid = $goodsdata['id'];
        //商品及其商品详情的关联查询
        $data = DB::table('tbl_goodsparam')
                ->join('tbl_goods','tbl_goods.id','=','tbl_goodsparam.gid')
                ->where('gid',$gid)
                ->first();

        $recdata = DB::table('tbl_goodsrecom')->get();
        return view('home.goods.goodsdetail',['data'=>$data,'recdata'=>$recdata,'gid'=>$gid]);
    }


      

    
}
